package net.mingsoft.document.action.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.mingsoft.document.biz.FileLogBiz;
import net.mingsoft.document.enums.FileOperateType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author gengfa
 * @date 22/03/24
 */
@RestController
@Api(value = "文件操作日志接口", tags = {"文件操作日志接口 - 外部服务调用"})
@RequestMapping(value = "/${ms.manager.path}/log")
public class FileLogAction {

    @Resource
    FileLogBiz logBiz;

    @GetMapping(value = "record/view")
    @ApiOperation(value = "预览日志记录")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(value = "fileId", name = "fileId")
    })
    public void recordView(@RequestParam("fileId") String fileId) {
        logBiz.record(fileId, FileOperateType.VIEW);
    }
}
